/*
 * jxSwing Project (2014)
 * 
 * by Denilson Edinaldo Pinto
 * 
 * LGPL
 * Copyright (C) 2014
 * 
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Lesser General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 * 
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
 * GNU Lesser General Public License for more details.
 * 
 * You should have received a copy of the GNU Lesser General Public License
 * along with this program. If not, see <http://www.gnu.org/licenses/>.
 */
package org.jxSwing.component.table.cellEditor;

import java.awt.BorderLayout;
import java.awt.FlowLayout;

import javax.swing.JLabel;
import javax.swing.JPanel;
import javax.swing.SwingConstants;

import org.jxSwing.component.button.AddButton;

/**
 * @author Denilson Edinaldo Pinto
 * @porject jxSwing
 * @package org.jxSwing.component.table.cellRenderer
 * @date 01/04/2014 - 20:18:14
 */
public class BeanEditorPanel extends JPanel {
	
	private static final long serialVersionUID = -166466059528434464L;
	
	private JPanel pnlButton = null;
	
	private AddButton button = null;
	
	private JLabel label = null;
	
	/**
	 * @param text
	 */
	public BeanEditorPanel(final String text) {
	
		super(new BorderLayout());
		
		pnlButton = new JPanel(new FlowLayout(FlowLayout.RIGHT));
		button = new AddButton();
		label = new JLabel(text);
		
		button.setSize(15, 15);
		
		label.setOpaque(true);
		label.setHorizontalAlignment(SwingConstants.CENTER);
		label.setVerticalAlignment(SwingConstants.CENTER);
		
		pnlButton.add(button);
		
		add(pnlButton, BorderLayout.EAST);
		add(label, BorderLayout.CENTER);
	}
	
	/**
	 * @return the button
	 */
	public AddButton getButton() {
	
		return button;
	}
	
	/**
	 * @return the label
	 */
	public JLabel getLabel() {
	
		return label;
	}
	
	/**
	 * @return the panelButton
	 */
	public JPanel getPnlButton() {
	
		return pnlButton;
	}
	
	/**
	 * @return the Text
	 */
	public String getText() {
	
		return getLabel().getText();
	}
}
